home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
9-Digit Zip Code Directory
/
9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO
/
z4src.zip
/
DCRC.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-26
|
4KB
|
133 lines
//----------------------------------------------------------------------------
// MODULE DESCRIPTION
//
// Module: dcrc.c
// Title: Application Template
// Notice: John M. Weeder
// Copyright (c) 1993. All rights reserved.
// This module contains proprietary information and should be
// treated as confidential.
//
//----------------------------------------------------------------------------
// MAINTENANCE HISTORY
//
// $Workfile$
// $Revision$
// $Author$
// $Date$
// $Log$
//
//----------------------------------------------------------------------------
// MODULE NARRATIVE
//
// This module contains the program entry point for
//
// The code in this module may be written in C++ or C.
//
// This module is portable to:
// DOS 3.X+
// MS Windows 3.X+
// OS/2 2.X+
// OS/2 2.0 PM
//
// The following compilers are supported:
// MSC 6.0A
// MSC/C++ 7.0
// Borland C++ 3.1 for DOS
// Borland C++ 1.0 for OS/2 2.X
//
//----------------------------------------------------------------------------
#include <dio.h>
//----------------------------------------------------------------------------
// Stack size
//----------------------------------------------------------------------------
#if COMPILER_BORLAND && (OS_DOS || OS_WINDOWS)
unsigned _stklen = 0x4000;
#endif
//----------------------------------------------------------------------------
// Globals
//----------------------------------------------------------------------------
//
// A useless string which is simply embedded in the executable.
//
PSZ __pszCredits__ = "Written by John M Weeder, 1993";
//
// This should contain a program description which will be displayed as
// part of the program's help text.
//
static PCSZ pcszDescription =
"This program calculates the CRC code for a logical data file.";
//
// Program command line options
//
static CHAR szPhysical[MAX_PATH];
static CHAR szLogical[MAX_PATH];
static CHAR szType[MAX_PATH];
static BS_CMDOPT acmdopt[] =
{
{ "physical", (PVOID)szPhysical, CMDOPT_FILESPECR(80), "Physical file."},
{ "logical", (PVOID)szLogical, CMDOPT_FILESPECR(80), "Logical file."},
{ "type", (PVOID)szType, CMDOPT_FILESPECR(80), "File type."},
BS_CMDOPT_NULL,
};
//----------------------------------------------------------------------------
// Description: main() - Program entry point
// Parameters: Standard C parameters
// Returns: DOS return code.
//----------------------------------------------------------------------------
int main(int argc, char **argv)
{
static BS_CFG cfg = CFG_DFT;
USHORT i, usType;
SHORT sResult = 99;
CRC crc;
//
// Initialize base library
//
BaseLibraryInitialize(argc, argv, &cfg);
BaseTitle("$Revision: 93.1 $", __DATE__, __TIME__, "Data File CRC Utility");
if (!BaseTitleHelp(acmdopt, pcszDescription,0))
return 99;
for (i = 0; adiotype[i].pszShort; ++i)
if (stricmp(adiotype[i].pszShort, szType) == 0)
{
usType = adiotype[i].usType;
break;
}
if (adiotype[i].pszShort == NULL)
{
Error("Invalid file type.");
Output("\nTypes:\n");
for (i = 0; adiotype[i].pszShort; ++i)
Output(" %4s %s\n", adiotype[i].pszShort, adiotype[i].pszLong);
return 1;
}
DioSetDataPath(EnvGet("DATA"));
Output("%s '%s'\n", szPhysical, szLogical);
if (DioCrc(szPhysical, szLogical, usType, &crc))
{
Output("CRC = 0x%08lX\n", crc);
Output("Success.\n");
sResult = 0;
}
else
Output("Success.\n");
DioCloseAll();
return sResult;
}
//----------------------------------------------------------------------------
//------------------------------- End of File --------------------------------
//----------------------------------------------------------------------------